import { reqIndexData } from '../../api/index'
Page({
  /**
   * 页面的初始数据
   */
  data: {
    bannerList: [],
    categoryList: [],
    activeList: [],
    hotList: [],
    guessList: [],
    loading: true
  },
  // 获取首页数据
  async getIndexData() {
    const res = await reqIndexData()
    // console.log(res)
    this.setData({
      bannerList: res[0].data,
      categoryList: res[1].data,
      activeList: res[2].data,
      guessList: res[3].data,
      hotList: res[4].data,
      loading: false
    })
  },
  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function () {
    this.getIndexData()
  },
  onShareAppMessage() {
    return {
      title: '所有的怦然心动，都是你',
      path: '/pages/index/index',
      imageUrl: '../../assets/images/love.jpg'
    }
  },
  onShareTimeline() {}
})
